﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPFInterview
{
    public class DialogsTest : IQuestion
    {
        public string TestName
        {
            get { return "WPF - Dialogs and WinForm Host"; }
        }

        public UserControl getUserControl()
        {
            return new DialogsQuestion();
        }
    }

    /// <summary>
    /// Interaction logic for DialogsQuestion.xaml
    /// </summary>
    public partial class DialogsQuestion : UserControl
    {
        public DialogsQuestion()
        {
            InitializeComponent();

            InitWinformHost();
        }

        private void buttonOpen_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                MessageBox.Show(dlg.FileName);
            }
        }

        private void InitWinformHost()
        {
            System.Windows.Forms.PropertyGrid grid = new System.Windows.Forms.PropertyGrid();
            grid.SelectedObject = new System.Windows.Window();
            grid.Name = "Property Grid";
            this.windowsFormsHost.Child = grid;

            _xamlPropertyGrid.SelectedObject = this;
        }
    }
}
